<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  <head>
    <title>Named output formats</title>
    <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
    <link rel="stylesheet" type="text/css" href="kawa.css"/>
    <script src="kawa-ebook.js" type="text/javascript"/>
    <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
    <link rel="prev" href="Input-Output.xhtml" title="Input, output, and file handling"/>
    <link rel="next" href="Paths.xhtml" title="Paths - file name, URLs, and URIs"/>
  </head>
  <body>
    <header/>
    <section class="sect1" title="Named output formats" epub:type="subchapter" id="Named-output-formats">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both">Named output formats</h2>
          </div>
        </div>
      </div>
      <p>The <code class="literal">--output-format</code> (or <code class="literal">--format</code>) command-line switch
can be used to override the default format for how values are
printed on the standard output.  This format is used for values printed
by the read-eval-print interactive interface.  It is also used to
control how values are printed when Kawa evaluates a file named on the
command line (using the <code class="literal">-f</code> flag or just a script name).
(It also affects applications compiled with the <code class="literal">--main</code> flag.)
It currently affects how values are printed by a <code class="literal">load</code>,
though that may change.
</p>
      <p>The default format depends on the current programming language.
For Scheme, the default is <code class="literal">scheme</code> for read-eval-print
interaction, and <code class="literal">ignore</code> for files that are loaded.
</p>
      <p>The formats currently supported include the following:
</p>
      <div class="variablelist" epub:type="list">
        <dl class="variablelist">
          <dt class="term"><code class="literal">scheme</code>
</dt>
          <dd>
            <p>Values are printed in a format matching the Scheme programming language,
as if using <code class="literal">display</code>.  "Groups" or "elements" are written as lists.
</p>
          </dd>
          <dt class="term"><code class="literal">readable-scheme</code>
</dt>
          <dd>
            <p>Like <code class="literal">scheme</code>, as if using <code class="literal">write</code>:
Values are generally printed in a way that they can
be read back by a Scheme reader.  For example, strings have quotation marks,
and character values are written like ‘<code class="literal">#\A</code>’.
</p>
          </dd>
          <dt class="term"><code class="literal">elisp</code>
</dt>
          <dd>
            <p>Values are printed in a format matching the Emacs Lisp programming language.
Mostly the same as <code class="literal">scheme</code>.
</p>
          </dd>
          <dt class="term"><code class="literal">readable-elisp</code>
</dt>
          <dd>
            <p>Like <code class="literal">elisp</code>, but values are generally printed in a way that they can
be read back by an Emacs Lisp reader.  For example, strings have quotation
marks, and character values are written like ‘<code class="literal">?A</code>’.
</p>
          </dd>
          <dt class="term"><code class="literal">clisp</code>
</dt>
          <dt class="term"><code class="literal">commonlisp</code>
</dt>
          <dd>
            <p>Values are printed in a format matching the Common Lisp programming language,
as if written by <code class="literal">princ</code>.
Mostly the same as <code class="literal">scheme</code>.
</p>
          </dd>
          <dt class="term"><code class="literal">readable-clisp</code>
</dt>
          <dt class="term"><code class="literal">readable-commonlisp</code>
</dt>
          <dd>
            <p>Like <code class="literal">clisp</code>, but as if written by <code class="literal">prin1</code>: values are generally
printed in a way that they can be read back by a Common Lisp reader.
For example, strings have quotation marks, and character values are
written like ‘<code class="literal">#\A</code>’.
</p>
          </dd>
          <dt class="term"><code class="literal">xml</code>
</dt>
          <dt class="term"><code class="literal">xhtml</code>
</dt>
          <dt class="term"><code class="literal">html</code>
</dt>
          <dd>
            <p>Values are printed in XML, XHTML, or HTML format.
This is discussed in more detail in <a class="link" href="Formatting-XML.xhtml" title="Formatting XML">Formatting XML</a>.
</p>
          </dd>
          <dt class="term"><code class="literal">cgi</code>
</dt>
          <dd>
            <p>The output should follow the CGI standards.  I.e. assume that this
script is invoked by a web server as a CGI script/program, and that the
output should start with some response header,
followed by the actual response data.
To generate the response headers, use the <code class="literal">response-header</code> function.
If the <code class="literal">Content-type</code> response header has not been specified, and
it is required by the CGI standard, Kawa will attempt
to infer an appropriate <code class="literal">Content-type</code> depending on the following value.
</p>
          </dd>
          <dt class="term"><code class="literal">ignore</code>
</dt>
          <dd>
            <p>Top-level values are ignored, instead of printed.
</p>
          </dd>
        </dl>
      </div>
    </section>
    <footer>
      <div class="navfooter">
        <p>
          Up: <a accesskey="u" href="Input-Output.xhtml">Input, output, and file handling</a></p>
        <p>
        Next: <a accesskey="n" href="Paths.xhtml">Paths - file name, URLs, and URIs</a></p>
      </div>
    </footer>
  </body>
</html>
